﻿using BrnMall.WeiXin.Sdk.Domain;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Core.Sdk.WeiXin.Domain.work
{
    /// <summary>
    /// 成员列表
    /// </summary>
    public class UserListListModel
    {
        public int errcode { get; set; }

        public string errmsg { get; set; }

        public List<User> userlist { get; set; }

    }

    /// <summary>
    /// 成员信息
    /// </summary>
    public class User
    {
        /// <summary>
        /// 成员UserID。对应管理端的帐号
        /// </summary>
        public string userid { get; set; }
        /// <summary>
        /// 成员名称
        /// </summary>
        public string name { get; set; }
        /// <summary>
        /// 成员所属部门
        /// </summary>
        public List<int> department { get; set; }
    }

    /// <summary>
    /// 成员详情
    /// </summary>
    public class UserDetail
    {
        public int errcode { get; set; }

        public string errmsg { get; set; }

        public string userid { get; set; }
        /// <summary>
        /// 微信号
        /// </summary>
        public string weixinid { get; set; }
        /// <summary>
        /// 中文名
        /// </summary>
        public string name { get; set; }
        /// <summary>
        /// 成员所属部门id列表
        /// </summary>
        public List<int> department { get; set; }
        /// <summary>
        /// 职位信息
        /// </summary>
        public string position { get; set; }
        /// <summary>
        /// 手机号码
        /// </summary>
        public string mobile { get; set; }
        /// <summary>
        /// 性别。0表示未定义，1表示男性，2表示女性
        /// </summary>
        public string gender { get; set; }

        public string email { get; set; }
        public string avatar { get; set; }
        /// <summary>
        /// 座机
        /// </summary>
        public string telephone { get; set; }

        public string qr_code { get; set; }

        /// <summary>
        /// 启用/禁用成员。1表示启用成员，0表示禁用成员
        /// </summary>
        public int enable { get; set; }      
    }

    /// <summary>
    /// 修改成员实体
    /// </summary>
    public class UpdateUserModel
    {

        public string userid { get; set; }
        /// <summary>
        /// 中文名
        /// </summary>
        public string name { get; set; }
        /// <summary>
        /// 成员所属部门id列表
        /// </summary>
        public List<int> department { get; set; }
        /// <summary>
        /// 职位信息
        /// </summary>
        public string position { get; set; }

        /// <summary>
        /// 启用/禁用成员。1表示启用成员，0表示禁用成员
        /// </summary>
        public int enable { get; set; }
    }
    /// <summary>
    /// 成员二维码
    /// </summary>
    public class UserQrCode : WorkJsonBase
    {
        /// <summary>
        /// 联系我二维码链接
        /// </summary>
        public string qr_code { get; set; }
        /// <summary>
        /// 二维码唯一标识
        /// </summary>
        public string config_id { get; set; }
    }

    /// <summary>
    /// 外部联系人信息
    /// </summary>
    public class ExtContactInfo: WorkJsonBase
    {
        public ExtContactDetail external_contact { get; set; }
        public List<ContactFollow> follow_user { get; set; }
    }
    /// <summary>
    /// 外部联系人详情
    /// </summary>
    public class ExtContactDetail 
    {
        /// <summary>
        /// 外部联系人的userid
        /// </summary>
        public string external_userid { get; set; }
        /// <summary>
        /// 联系人的名称
        /// </summary>
        public string name { get; set; } = string.Empty;
        /// <summary>
        /// 头像
        /// </summary>
        public string avatar { get; set; } = string.Empty;
        /// <summary>
        /// 性别。0表示未定义，1表示男性，2表示女性
        /// </summary>
        public int gender { get; set; }
    }
    /// <summary>
    /// 外部联系人所属成员
    /// </summary>
    public class ContactFollow
    {
        /// <summary>
        /// 企业成员userid
        /// </summary>
        public string userid { get; set; } = string.Empty;
        /// <summary>
        /// 自定义标识
        /// </summary>
        public string state { get; set; } = string.Empty;
        public string description { get; set; } = string.Empty;
        public string createtime { get; set; } = string.Empty;

        /// <summary>
        /// 发起添加的userid
        /// 如果成员主动添加，为成员的userid；
        /// 如果是客户主动添加，则为客户的外部联系人userid；
        /// 如果是内部成员共享/管理员分配，则为对应的成员/管理员userid
        /// </summary>
        public string oper_userid { get; set; }
        /// <summary>
        /// 成员添加此客户的来源
        /// </summary>
        public string add_way { get; set; }
    }

    public class AdminListModel : WorkJsonBase
    {
        public List<AdminModel> admin { get; set; }
    }

    /// <summary>
    /// 管理员详情
    /// </summary>
    public class AdminModel
    {
        /// <summary>
        /// 管理员的userid
        /// </summary>
        public string userid { get; set;}
        /// <summary>
        /// 管理员的open_userid
        /// </summary>
        public string open_userid { get; set; }
        /// <summary>
        /// 权限：0 发消息权限，1 管理权限
        /// </summary>
        public int auth_type { get; set; }
    }
}